package cz.muni.fi.pa165.musiclibrary.implejb.service.dto;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import cz.muni.fi.pa165.musiclibrary.api.service.dto.IArtistDTO;

/**
 *
 * @author Martin Szabo
 * 2012-10-28T22:36:48+0100
 */
public final class ArtistDTO implements IArtistDTO{
    
    /**
     * Identifier of this artist.
     */
    private Long idArtist;
    /**
     * Name of this artist.
     */
    private String name;
    
    /**
     * Description of this artist.
     */
    private String description;
    
    @Override
    public Long getIdArtist() {
        return this.idArtist;
    }

    @Override
    public String getName() {
        return this.name;
    }
    
    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public void setIdArtist(final Long idArtist) {
        this.idArtist = idArtist;
    }

    @Override
    public void setName(final String name) {
        this.name = name;
    }
    
    @Override
    public void setDescription(final String description) {
        this.description = description;
    }

    /**
     * Implemented using {@link EqualsBuilder}.
     * 
     * {@inheritDoc }
     */
    @Override
    public boolean equals(final Object obj) {
        if (obj == null || !(obj instanceof IArtistDTO)) {
            return false;
        }
        
        final IArtistDTO other = (IArtistDTO) obj;
        return new EqualsBuilder()//
                .append(this.getIdArtist(), other.getIdArtist())//
                .build();
    }
    
    /**
     * Implemented using {@link HashCodeBuilder}.
     * 
     * {@inheritDoc }.
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder()//
                .append(this.getIdArtist())//
                .build();
    }

    /**
     * Implemented using {@link ToStringBuilder#reflectionToString(java.lang.Object, org.apache.commons.lang3.builder.ToStringStyle) }
     * with second argument {@link ToStringStyle#MULTI_LINE_STYLE}.
     */
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

}
